package com.ushio.orderservice.operate;

import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

@RestController
@RequestMapping("/commodity")
public class Commodity {
    @PostMapping("/type")
    public List<Map<String,String>> getCommodity(@RequestBody CommodityPojo commodityPojo){

        List<Map<String,String>> list = new ArrayList<>();

        Map<String,String> map = new HashMap<>();
        Map<String,String> map2 = new HashMap<>();

        switch (commodityPojo.getType()){
            case "电子":

                map.put("commodity","电脑");
                map2.put("commodity","鼠标");
                break;
            default:
                map.put("commodity","洗衣粉");
                map2.put("commodity","洗衣机");
                break;
        }

        list.add(map);
        list.add(map2);

        return list;

    }

}
